package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.system.domain.SysMapIcon;
import com.ruoyi.system.service.ISysMapIconService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 标点图标管理Controller
 *
 * @author yangyu
 * @date 2022-11-09
 */
@Api(tags = " 标点图标管理")
@RestController
@RequestMapping("/sysMapIcon")
public class SysMapIconController extends BaseController {
    @Autowired
    private ISysMapIconService sysMapIconService;

    /**
     * 查询标点图标管理列表
     */
    @ApiOperation(value="查询标点图标管理列表", notes="查询标点图标管理列表")
    @PreAuthorize(hasPermi = "system:sysMapIcon:list")
    @GetMapping("/list")
    public TableDataInfo list(SysMapIcon sysMapIcon) {
        startPage();
        List<SysMapIcon> list = sysMapIconService.selectSysMapIconList(sysMapIcon);
        return getDataTable(list);
    }

    /**
     * 导出标点图标管理列表
     */
    @ApiOperation(value="导出标点图标管理列表", notes="导出标点图标管理列表")
    @PreAuthorize(hasPermi = "system:sysMapIcon:export")
    @Log(title = "标点图标管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysMapIcon sysMapIcon) throws IOException {
        List<SysMapIcon> list = sysMapIconService.selectSysMapIconList(sysMapIcon);
        ExcelUtil<SysMapIcon> util = new ExcelUtil<SysMapIcon>(SysMapIcon.class);
        util.exportExcel(response, list, "标点图标管理数据");
    }
    /**
     * 获取标点图标管理详细信息
     */
    @ApiOperation(value="获取标点图标管理详细信息", notes="获取标点图标管理详细信息")
    @PreAuthorize(hasPermi = "system:sysMapIcon:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(sysMapIconService.selectSysMapIconById(id));
    }

    /**
     * 新增标点图标管理
     */
    @ApiOperation(value="新增标点图标管理", notes="新增标点图标管理")
    @PreAuthorize(hasPermi = "system:sysMapIcon:add")
    @Log(title = "标点图标管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysMapIcon sysMapIcon) {
        return toAjax(sysMapIconService.insertSysMapIcon(sysMapIcon));
    }

    /**
     * 修改标点图标管理
     */
    @ApiOperation(value="修改标点图标管理", notes="修改标点图标管理")
    @PreAuthorize(hasPermi = "system:sysMapIcon:edit")
    @Log(title = "标点图标管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysMapIcon sysMapIcon) {
        return toAjax(sysMapIconService.updateSysMapIcon(sysMapIcon));
    }

    /**
     * 删除标点图标管理
     */
    @ApiOperation(value="删除标点图标管理", notes="删除标点图标管理")
    @ApiImplicitParam(name = "ids", value = "标点图标管理ID数组", required = true,paramType = "path", allowMultiple=true, dataType = "String")
    @PreAuthorize(hasPermi = "system:sysMapIcon:remove")
    @Log(title = "标点图标管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(sysMapIconService.deleteSysMapIconByIds(ids));
    }
}
